home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
src
/
fig09_08.jar
/
Ch09
/
Fig09_08
/
Point2.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1997-10-26
|
478b
|
24 lines
// Fig. 9.8: point2.cpp
// Member functions for class Point
#include <iostream.h>
#include "point2.h"
// Constructor for class Point
Point::Point( int a, int b ) { setPoint( a, b ); }
// Set the x and y coordinates
void Point::setPoint( int a, int b )
{
x = a;
y = b;
}
// Output the Point
ostream &operator<<( ostream &output, const Point &p )
{
output << '[' << p.x << ", " << p.y << ']';
return output; // enables cascading
}